package test01;

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        try(Scanner scanner = new Scanner(System.in)){
            int n = scanner.nextInt();
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = scanner.nextInt();
            }
            int k = scanner.nextInt();
            for (int i = 0; i < k; i++) {
                int x = scanner.nextInt();
                int temp = arr[x-1];
                for (int j = x; j < n; j++) {
                    arr[j-1] = arr[j];
                }
                arr[n-1] = temp;
            }
            for (int i=0; i<n; i++) {
                System.out.print(arr[i]+" ");
            }
        }
    }
}